<template>
 <div class="get-award">
    <h1>中奖名单</h1>
    <div class="person-show">
      <swiper :options="swiperOption" ref="mySwiper">
        <swiper-slide v-for="item1 in 6" :key="item1">
          <div v-for="item2 in 5" :key="item2" class="person-show-content">
            <div v-for="item3 in 4" :key="item3" class="person-show-item animated zoomIn">
              <div class="person-show-item-img">
                <div class="headimg">
                  <img src="../../static/imgs/1.jpg" alt="">
                </div>
              </div>
              <div class="person-show-item-text">
                123
              </div>
            </div>
          </div>
        </swiper-slide>
      </swiper>
    </div>
    <el-dialog :visible.sync="showPersonDialog" :show-close="false" title="获奖人祝福语" :center="true">
      <div class="talk-box animated zoomIn" v-for="item in 5" :key="item">
        <div class="talk-box-img">
          <img src="../../static/imgs/1.jpg" alt="">
        </div>
        <div class="talk-box-content">
          <p class="talk-box-content-nick-name">123</p>
          <p class="talk-box-content-text">新年快乐新年快乐新年快乐新年快乐新年快乐新年快乐</p>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'GetAward',
  data () {
    return {
      swiperOption: {
        notNextTick: true,
        keyboard: {
          enabled: true,
          onlyInViewport: true
        }
      },
      showPersonDialog: false
    }
  },
  mounted () {
    document.onkeydown = e => {
      if (e.keyCode === 70 && this.$route.name === 'GetAward') {
        // F键返回抽奖页面
        this.$router.go(-1)
      }
      if (e.keyCode === 84 && this.$route.name === 'GetAward') {
        // T键展示获奖人评论页面
        this.showPersonDialog = !this.showPersonDialog
      }
    }
  }
}
</script>

<style lang="less">
.get-award {
  color: #fff;
  h1 {
    text-align: center;
    font-size: 48px;
  }
  .person-show {
    margin: 15px;
    .swiper-slide {
      display: flex;
      .person-show-content {
        flex: 1;
        .person-show-item {
          padding: 15px;
          .person-show-item-img {
            width: 145px;
            height: 145px;
            text-align: center;
            margin: 0 auto;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            &::before {
              position: absolute;
              top: 0;
              left: 0;
              content: '';
              width: 100%;
              height: 100%;
              background-image: url('../../static/imgs/head-gold-box.png');
              background-size: 100% 100%;
              animation: light-rotate 2.5s linear infinite;
            }
            &:after {
              position: absolute;
              width: 58px;
              height: 58px;
              left: -10px;
              top: -10px;
              content: '';
              transform: rotate(-30deg);
              background-image: url('../../static/imgs/get.png');
              background-size: 100% 100%;
            }
            @-webkit-keyframes light-rotate {
              form {
                -webkit-transform: rotate(0);
                transform: rotate(0);
              }
              to {
                -webkit-transform: rotate(1turn);
                transform: rotate(1turn);
              }
            }
            .headimg {
              width: 120px;
              height: 120px;
              position: relative;
              img {
                width: 100%;
                height: 100%;
                border-radius: 50%;
              }
            }
          }
          .person-show-item-text {
            text-align: center;
            margin-top: 5px;
            font-size: 24px;
            padding: 5px 0;
            width: 100%;
            background-size: 100% 100%;
            background-image: url('../../static/imgs/nickName.png');
          }
        }
      }
    }
  }
  .el-dialog {
    .el-dialog__header {
      background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
      .el-dialog__title {
        font-size: 36px;
        color: #fff;
      }
    }
    .el-dialog__body {
      background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
      color: #fff;
      .talk-box {
        border: 1px solid #fff;
        border-radius: 15px;
        margin-top: 10px;
        &:nth-child(1) {
          margin-top: 0;
        }
        .talk-box-img {
          display: inline-block;
          vertical-align: top;
          img {
            width: 120px;
            height: 120px;
            border-radius: 50%;
          }
        }
        .talk-box-content {
          display: inline-block;
          vertical-align: top;
          .talk-box-content-nick-name {
            font-size: 20px;
          }
          .talk-box-content-text {
            font-size: 24px;
          }
        }
      }
    }
  }
}
</style>
